home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / mint / lib / mntlib44.zoo / mntlib / purec / Makefile < prev    next >
Makefile  |  1994-03-01  |  18KB  |  632 lines

  1. ### Makefile for MiNT Library for Pure C and Turbo C
  2. ### hohmuth 19 Feb 1993
  3. ###
  4. ### This makefile needs GNU make.
  5. ###
  6. ### This makefile is pretty tough.. Make sure your make has a large stack!
  7. ### (The MiNT library's standard stack size (8K) is _not_ enough!)
  8.  
  9. ###
  10. ### begin of configuration section
  11. ###
  12.  
  13. # TURBOC= yes if you still use Turbo C.
  14. # If you do so, I strongly suggest upgrading to Pure C.
  15. # Comment this out if you use Pure C.
  16.  
  17. #TURBOC=        yes
  18.  
  19. # COMPILERDIR= the main directory of your Turbo/Pure C installation
  20. # As file names in rules may not contain colons (`:'), this path
  21. # name should _not_ contain a TOS-style drive specification (like "c:").
  22. # If you define TOSIFY_COMMANDS below, this path will be automatically 
  23. # tosified.
  24.  
  25. #COMPILERDIR=    /dev/g/turboc
  26. COMPILERDIR=    /dev/d/pc
  27.  
  28. # BINDIR= where your compiler's tools (pcc.ttp, plink.ttp etc.) reside
  29.  
  30. #BINDIR=        $(COMPILERDIR)
  31. BINDIR=        $(COMPILERDIR)/bin
  32.  
  33. # LIBDIR= where to search for the compiler's libraries. Some of them are
  34. # linked into the MiNT library.
  35.  
  36. LIBDIR=        $(COMPILERDIR)/lib
  37.  
  38. # COMPILERINCDIR= where to find your compiler's includes, especially
  39. # float.h and math.h.
  40. # This is only needed during "make install-includes".
  41.  
  42. COMPILERINCDIR=    $(COMPILERDIR)/include
  43.  
  44. # INCLUDEDIR= where your MiNT library's include files (mntinc) reside.
  45. # If you define TOSIFY_NAMES below, this is path will be automatically 
  46. # tosified for the compiler's -I switch.
  47.  
  48. INCLUDEDIR=    /dev/z/src/lib/include
  49.  
  50. # OSBINDLIB= the location of the osbind library by Ole Arndt und 
  51. # Ulf Moeller, if you have it.  This library replaces our TOS bindings.
  52. # If you use Turbo C, and don't have `awk', you _should_ get this library.
  53. # If you don't have it, you need to have `awk'.  (we need to hack our
  54. # TOS bindings) 
  55. # For Pure C users: You don't need to have this library.
  56. # Comment this out, if you don't have the osbind library.
  57.  
  58. #OSBINDLIB=    $(LIBDIR)/osbind.lib
  59.  
  60. # INSTALLDIR= the directory you want to have the MiNT library installed to.
  61. # This is only needed during "make install".
  62.  
  63. INSTALLDIR=    $(LIBDIR)
  64.  
  65. # COMMONDIR= where the main bulk of the library source resides
  66.  
  67. COMMONDIR=    ..
  68.  
  69. # ASSERTIONS= yes if you want to activate the library's calls to assert().
  70. # Comment this out if you don't.
  71.  
  72. #ASSERTIONS=    yes
  73.  
  74. # DEBUGINFO= yes, if you want your libraries created with debug info.
  75. # Comment this out if you don't.
  76.  
  77. #DEBUGINFO=    yes
  78.  
  79. # PCREL= yes, if you want all sub-routine calls to be PC relative.
  80. # This can cause problems with bigger projects, however.
  81. # Comment this out if you prefer absolute calls to sub-routines.
  82.  
  83. #PCREL= yes
  84.  
  85. # TOSIFY_NAMES= yes if the compiler's tools (pcc, plink etc.) don't 
  86. # understand Unix-like path names.
  87. # Comment this out if your compiler _does_ understand names like "/dev/c/foo".
  88.  
  89. TOSIFY_NAMES=    yes
  90.  
  91. # TOSIFY_COMMANDS= yes if your shell (see SHELL below) wants path names
  92. # in TOS form (i.e. does not understand unix compatible file names like
  93. # "/dev/c/foo"). Mupfel wants this.
  94. # Comment this out if your shell groks names like "/dev/c/foo".
  95. # NOTE: your versions of rm, cp, etc. _should_ understand
  96. #       unix-like names
  97.  
  98. #TOSIFY_COMMANDS=    yes
  99.  
  100. # sh_backslash= the string that should be passed to the shell as a single
  101. # backslash character. This depends on your shell (whether your
  102. # shell needs backslashes escaped with another backslash, as do most
  103. # unix-like shells). On contrast, Mupfel wants only one backslash, as well
  104. # as the shell that comes with `elvis'.
  105.  
  106. sh_backslash=    \\
  107. #sh_backslash=    \$(nothing)
  108.  
  109. # SHELL, RM, CP, INSTALL_DATA, AWK, ECHO: edit to suite your taste
  110. # These programs _should_ understand unix-like path names (like "/dev/c/foo").
  111. # INSTALL_DATA is only needed during "make install" and "make install-includes".
  112. # AWK is only needed when using Turbo C without the osbind library (see
  113. # explanation on OSBINDLIB above)
  114. # ECHO is only needed with Turbo C.
  115. #
  116. # all of these programs should understand the ARGV scheme.
  117.  
  118. SHELL=        /bin/sh            # a bourne shell
  119. #SHELL=        /usr/local/bin/bash    # GNU bash
  120. #SHELL=        c:/usr/gemini/1.89/mupfel.ttp # Mupfel 1.89 (don't try 1.21)
  121. #SHELL=        c:/bin/shell.ttp    # simple shell (from `elvis' distribution)
  122. #SHELL=                    # no shell at all (works only with Pure C)
  123.  
  124. RM=        rm
  125. CP=        cp
  126. AWK=        awk
  127. ECHO=        echo
  128. INSTALL_DATA=    cp
  129. #INSTALL_DATA=    install -m 644
  130.  
  131. ###
  132. ### end of configuration section
  133. ###
  134.  
  135. ### the compiler programs, and what flags they need
  136.  
  137. ifdef TOSIFY_NAMES
  138.   DIRSEP=    $(sh_backslash)
  139. else
  140.   DIRSEP=    /
  141. endif
  142.  
  143. ifdef TURBOC
  144.   CC :=        $(BINDIR)/tcc.ttp -W
  145.   AS :=        $(BINDIR)/mas.ttp
  146.   LD :=        $(BINDIR)/tlink.ttp
  147. else
  148.   CC :=        $(BINDIR)/pcc.ttp -W
  149.   AS :=        $(BINDIR)/pasm.ttp
  150.   LD :=        $(BINDIR)/plink.ttp
  151. endif
  152.  
  153. ifdef TOSIFY_COMMANDS
  154.   tosify_name := $(CC)
  155.   include tosify.mak
  156.   CC := $(tosify_name)
  157.  
  158.   tosify_name := $(AS)
  159.   include tosify.mak
  160.   AS := $(tosify_name)
  161.  
  162.   tosify_name := $(LD)
  163.   include tosify.mak
  164.   LD := $(tosify_name)
  165. endif
  166.  
  167. ifdef DEBUGINFO
  168.   CCSYMFLAGS=    -Y
  169.   ifdef TURBOC
  170.     ASSYMFLAGS=
  171.   else
  172.     ASSYMFLAGS=    -Y
  173.   endif
  174.   LDSYMFLAGS=    -G -L -Y
  175. else
  176.   CCSYMFLAGS=
  177.   ASSYMFLAGS=
  178.   LDSYMFLAGS=    -G
  179. endif
  180.  
  181. ifdef PCREL
  182.   CCRELFLAGS=
  183. else
  184.   CCRELFLAGS=    -P
  185. endif
  186.  
  187. MAKEOBJ=    -J
  188.  
  189. ifdef ASSERTIONS
  190.   CCDEBUGDEFS=
  191. else
  192.   CCDEBUGDEFS=    -DNDEBUG
  193. endif
  194.  
  195. INCSPEC :=    $(INCLUDEDIR)
  196.  
  197. # tosify the include specification
  198. ifdef TOSIFY_NAMES
  199.   tosify_name := $(INCSPEC)
  200.   include tosify.mak
  201.   INCSPEC := $(tosify_name)
  202. endif
  203.  
  204. CCINCFLAGS=    -I$(INCSPEC)
  205.  
  206. # with Turbo C, we need to work around its missing ARGV capability
  207. ifdef TURBOC
  208.   ARGV_WORKAROUND=    yes
  209. else
  210.   ARGV_WORKAROUND=
  211. endif
  212.  
  213. ### default flags to compiler, linker, assembler
  214.  
  215. CCFLAGS=    $(CCINCFLAGS) $(CCSYMFLAGS) $(CCRELFLAGS) $(CCDEBUGDEFS)
  216. ASFLAGS=    $(ASSYMFLAGS)
  217. LDFLAGS=    $(LDSYMFLAGS)
  218.  
  219. ### what to build
  220.  
  221. MINTLIB=    mintlib.lib
  222. MATHLIB=    mintflt.lib
  223. FPUMATHLIB=    mint881.lib
  224. STARTUPOBJ=    crt0.o
  225. ALLOCAOBJ=    alloca.o
  226. FPUALLOCAOBJ=    falloca.o
  227.  
  228. MYTOSLIB=    myosbind.lib
  229.  
  230. DIST_MATHLIB=    d_flt.lib
  231. DIST_FPUMATHLIB=    d_881.lib
  232.  
  233. ifdef TURBOC
  234.   ALL=        $(MINTLIB) $(MATHLIB) $(STARTUPOBJ) $(ALLOCAOBJ)
  235.   BINDIST=    $(MINTLIB) $(DIST_MATHLIB) $(STARTUPOBJ) $(ALLOCAOBJ)
  236. else
  237.   ALL=        $(MINTLIB) $(MATHLIB) $(STARTUPOBJ) $(ALLOCAOBJ) \
  238.     $(FPUMATHLIB) $(FPUALLOCAOBJ)
  239.   BINDIST=    $(MINTLIB) $(DIST_MATHLIB) $(STARTUPOBJ) $(ALLOCAOBJ) \
  240.     $(DIST_FPUMATHLIB) $(FPUALLOCAOBJ)
  241. endif
  242.  
  243. .PHONY:        all
  244. all:        $(ALL)
  245.  
  246. .PHONY:        bindist
  247. bindist:    $(BINDIST)
  248.  
  249. ### things we link from the compiler's distribution
  250.  
  251. ifdef TURBOC
  252.   CCFLOATLIB :=    $(LIBDIR)/tcfltlib.lib
  253. else
  254.   CCFLOATLIB :=    $(LIBDIR)/pcfltlib.lib
  255.   CC881LIB :=    $(LIBDIR)/pc881lib.lib
  256. endif
  257.  
  258. CCFLOATLIBSPEC :=    $(CCFLOATLIB)
  259. CC881LIBSPEC :=    $(CC881LIB)
  260.  
  261. # tosify the library specifications, if nessecary
  262. ifdef TOSIFY_NAMES
  263.   tosify_name := $(CCFLOATLIBSPEC)
  264.   include tosify.mak
  265.   CCFLOATLIBSPEC := $(tosify_name)
  266.  
  267.   tosify_name := $(CC881LIBSPEC)
  268.   include tosify.mak
  269.   CC881LIBSPEC := $(tosify_name)
  270. endif
  271.  
  272. ### which OS bindings library to link
  273.  
  274. BUILD_MYTOSLIB_DEP :=
  275.  
  276. # the osbind library replaces our tos library.
  277. ifdef OSBINDLIB
  278.   TOSLIB :=    $(OSBINDLIB)
  279. else
  280.   ifdef TURBOC
  281.     TOSLIB :=    $(MYTOSLIB)
  282.  
  283.     # used as a file dependency for $(MINTLIB)
  284.     BUILD_MYTOSLIB_DEP :=    $(MYTOSLIB)
  285.   else
  286.     TOSLIB :=
  287.   endif
  288. endif
  289.  
  290. TOSLIBSPEC :=    $(TOSLIB)
  291.  
  292. # tosify the library specification, if nessecary
  293. ifdef TOSIFY_NAMES
  294.   tosify_name := $(TOSLIBSPEC)
  295.   include tosify.mak
  296.   TOSLIBSPEC := $(tosify_name)
  297. endif
  298.  
  299. ### how to build MINTLIB
  300.  
  301. COMMONSRC :=    a64l.c abort.c abs.c access.c alarm.c alphasor.c atexit.c \
  302.   atoi.c atol.c bblink.c bcmp.c binmode.c bsearch.c calloc.c \
  303.   cfgetisp.c cfgetosp.c cfsetisp.c cfsetosp.c chdir.c \
  304.   chmod.c chown.c clock.c close.c closedir.c console.c crtinit.c ctermid.c \
  305.   ctime.c ctype.c defmode.c \
  306.   doprnt.c do_lock.c do_stat.c dup.c dup2.c eprintf.c \
  307.   execl.c execle.c execp.c execv.c execve.c \
  308.   fclose.c fcntl.c fdopen.c fflush.c \
  309.   fgetc.c fgetpos.c fgets.c filbuf.c findfile.c flock.c fopen.c \
  310.   fopen_i.